﻿@extends('common.header')

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="white">
	<meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="keywords" content="">
    <meta name="description" content="">
	<title>{{ $photo_info->title }}{{ $webConfig->webName }}</title>
	<meta name="Description" content="{{ $photo_info->desc }}" />
	<link rel="shortcut icon" href="{{ asset('/images/favicon.ico') }}" />
	<link rel="stylesheet" type="text/css" href="{{ asset('/css/photos/pic-lib-inner.css') }}"/>
	<script type="text/javascript" src="{{ asset('/js/jquery.min.js') }}"></script>
	<script type="text/javascript" >
		
		<!-- 2.设置全局ajax选项 -->
		$.ajaxSetup({
			headers: {
				'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
			}
		});
		// 获取 token
		var _token = $('meta[name="csrf-token"]').attr('content');
		
		// 评论 回复 功能
		// 原始评论id 被回复人id
        function reply( type,comment_id,user_id,id) {
            // 回复内容
            switch(type)
            {
                case 'reply':
                    var content = $("#reply_content_"+id).val();
                    break;
                case 'huifu':
                    var content = $("#huifu_content_"+id).val();
                    break;
            }

            $.ajax({
                type: "post",
                url: "{{ url('/commentReply') }}",
                data: {comment_id: comment_id, user_id: user_id, content: content, _token: _token},
                async: false,
                dataType: "json",
                success: function (back) {
                    if (back['show_info'] == '回复成功') {

                        $('.err-tip').html('');
                        $('.err-tip').html(back['show_info']);
                        $(".err-tip").slideDown(1500);
                        $(".err-tip").delay(1500).slideUp(1000);
                        $("textarea[name='comment-content']").val('');
                        setTimeout(function () {
                            location.reload();
                        }, 1000);
                    } else {
                        $('.err-tip').html('');
                        $('.err-tip').html(back['show_info']);
                        $(".err-tip").slideDown(1500);
                        $(".err-tip").delay(1500).slideUp(1000);
                    }
                }
            });

        }
        var isShow = false;

        // 点击评论的回复 评论id
        function showReply(comment_id)
        {
            // 回复的窗口 全部隐藏
            $("div[id*='reply_']").hide();
            $("div[id*='huifu_']").hide();
            if( !isShow )
            {
                $("#reply_"+comment_id).show();
                isShow = true;
            }else
            {
                $("#reply_"+comment_id).hide();
                isShow = false;
            }
        }

        // 点击回复的 提交按钮
        function huifu(reply_id)
        {
            // 回复的窗口 全部隐藏
            $("div[id*='reply_']").hide();
            $("div[id*='huifu_']").hide();
            if( !isShow )
            {
                $("#huifu_"+reply_id).show();
                isShow = true;
            }else
            {
                $("#huifu_"+reply_id).hide();
                isShow = false;
            }

        }
	
	
		// 点赞
		function replyPraise( prefix,id,likeType )
		{
			var obj = $("#"+prefix+"_praise_"+id);
			var isPraise = obj.attr('isPraise');
			if (isPraise == 'false')
			{
				// 未点赞
				// 获取 现有 赞数
				var num = parseInt($("#"+prefix+"_praise_txt_"+id).text());
				// +1
				num += 1;
				$("#"+prefix+"_praise_txt_"+id).text(num);
				// 已赞图片
				$("#"+prefix+"_praise_img_"+id).attr("src", "{{ asset('/images/articles/yizan.png') }}");
				// 写进 数据库
				$.ajax({
					type: "post",
					url: "{{ url('/commentLike') }}/"+likeType,
					data: {id: id, _token: _token},
					async: false,
					dataType: "json",
					success: function (back)
					{
						// alert(back['show_info']);
					}
				});
				// 设置为 已点赞
				obj.attr('isPraise', 'true');

			}else
			{
				// 已点赞
				$("#"+prefix+"_praise_warn_"+id).html('');
				$("#"+prefix+"_praise_warn_"+id).html('您已赞过');
				$("#"+prefix+"_praise_warn_"+id).show();
				setTimeout(function(){
					$("#"+prefix+"_praise_warn_"+id).hide();
				},1000);
			}

		}
		
		
		
	// 收藏
	function collect( prefix,id,collectType )
	{
		var obj = $("#"+prefix+"_collect_"+id);
		var isCollect = obj.attr('isCollect');
		if (isCollect == 'false')
		{
			// 未收藏
			
			// 写进 数据库
			$.ajax({
				type: "post",
				url: "{{ url('/collect') }}/"+collectType,
				data: {id: id,_token: _token},
				async: false,
				dataType: "json",
				success: function (back)
				{
					
					if( back['show_info']!='' )
					{
						$("#"+prefix+"_praise_warn_"+id).html('');
						$("#"+prefix+"_praise_warn_"+id).html('您已收藏过');
						$("#"+prefix+"_praise_warn_"+id).show();
						setTimeout(function(){
							$("#"+prefix+"_praise_warn_"+id).hide();
						},1000);
						// 已收藏图片
						$("#"+prefix+"_collect_img_"+id).attr("src", "{{ asset('/images/articles/yicang.png') }}");
					}else
					{
						$("#"+prefix+"_praise_warn_"+id).html('');
						$("#"+prefix+"_praise_warn_"+id).html('收藏成功');
						$("#"+prefix+"_praise_warn_"+id).show();
						setTimeout(function(){
							$("#"+prefix+"_praise_warn_"+id).hide();
						},1000);
						// 已收藏图片
						$("#"+prefix+"_collect_img_"+id).attr("src", "{{ asset('/images/articles/yicang.png') }}");
					}
					
				}
			});
			// 设置为 已收藏
			obj.attr('isCollect', 'true');
			
		}else
		{
			// 已收藏
			$("#"+prefix+"_praise_warn_"+id).html('');
			$("#"+prefix+"_praise_warn_"+id).html('您已收藏过');
			$("#"+prefix+"_praise_warn_"+id).show();
			setTimeout(function(){
				$("#"+prefix+"_praise_warn_"+id).hide();
			},1000);
			// 已收藏图片
			$("#"+prefix+"_collect_img_"+id).attr("src", "{{ asset('/images/articles/yicang.png') }}");
		}
	
	}
		
		
		
		
		
	</script>
	
</head>
<body style="background:#fff;">
<!--面包屑导航-->
<div style="width: 1200px;height: 40px;line-height:40px;position: relative;margin: 110px auto 0">
    <ol style="float: left;overflow: hidden;color: #333;list-style: none;">
        <li style="float: left;margin-left: 5px">当前位置：</li>
        <li style="float: left;margin-left: 5px"><a href="{{ url('/') }}" style="color: #de1e30;margin-left: 5px">首页</a></li>
        <li style="float: left;margin-left: 5px"><a href="{{ url('/photoList') }}" style="color: #de1e30;margin-left: 5px">> 图库列表</a></li>
		<li style="float: left;margin-left: 5px"> </li>
    </ol>
</div>

<!--图库内页内容-->
<div class="inner-main" >
    
	<!--左边主体内容-->
    <div class="left-con">
		<!--左边主体图片-->
        <div class="swp-wrap">
            <div class="main">
                <!--图片特效内容开始-->
                <div class="piccontext">
                    <h2>{{ $photo_info->title }}</h2>
                    <div class="source">
                        <div class="source_left"> 来源：{{ $photo_info->from }}<span>{{ $photo_info->create_at }}</span> </div>
                        <div class="source_right">
                            <div class="support"> 支持←→键翻阅图片 </div>
                             </div>
                    </div>
                   
				   <!--大图展示-->
                    <div class="picshow">
                        
						<div class="picshowtop">
							@forelse( $pics_info as $key=>$pic_info )
								@if( $pic_info['status']==1 )
								<a href="#">
									<img src="{{ $pic_info['pic_url'] }}" alt="" id="pic1" curindex="0" />
								</a>
								@else
								@break
								@endif
							@empty
							@endforelse
                            <a id="preArrow" href="javascript:void(0)" class="contextDiv" title="上一张"><span id="preArrow_A"></span></a>
                            <a id="nextArrow" href="javascript:void(0)" class="contextDiv" title="下一张"><span id="nextArrow_A"></span></a>
                        </div>
                        
						<!--图册展示结束提示-->
                        <div class="end-msg">
                            <h3>本图集已浏览完毕</h3>
                            <div class="end-tools">
								@if( !empty($next_photo) )
                                <a href="{{ url('/photoDetail') }}/{{ $next_photo->id }}"><span>下一图集</span></a>
								
								@else
								@endif
                                <span id="replay">重新浏览</span>
                                <a href="{{ url('/photoList') }}"><span>图库首页</span></a>
                            </div>
                            <div class="adv">
                                <img src="" alt=""/>
                            </div>

                        </div>
                        
						<div class="picshowtxt">
                            <div class="picshowtxt_left"><span>1</span>/<i>{{ count($pics_info) }}</i></div>
                            <div class="picshowtxt_right"></div>
                        </div>
                        
						
						
						<div class="picshowlist">
                            
							<!--上一条图库-->
							@if( !empty($prev_photo) )
                            <div class="picshowlist_left">
                                <div class="picleftimg">
									<a href="{{ url('/photoDetail') }}/{{ $prev_photo->id }}" >
										<img src="{{ $prev_photo->pic_url }}" title="{{ $prev_photo->title }}" alt="{{ $prev_photo->title }}" />
									</a> 
								</div>
                            </div>
							@else
							@endif
                           
						   <div class="picshowlist_mid">
                                <div class="picmidleft"> <a href="javascript:void(0)" id="preArrow_B"></a> </div>
                                <div class="picmidmid">
									<!-- 小图列表  -->
                                    <ul>
										@forelse( $pics_info as $key => $pic_info )
                                        <li>
											<a href="javascript:void(0);">
												<img src="{{ $pic_info['pic_url'] }}" alt="{{ $pic_info['desc'] }}" title="{{ $pic_info['desc'] }}" bigimg="{{ $pic_info['pic_url'] }}" text="{{ $pic_info['desc'] }}" />
											</a>
										</li>
										@empty
										@endforelse
                                    </ul>
                                </div>
                                <div class="picmidright">
									<a href="javascript:void(0)" id="nextArrow_B"></a>
								</div>
                            </div>
							
                            <!-- 下一张图库新闻 -->
							@if( !empty($next_photo) )
                            <div class="picshowlist_right">
                                <div class="picleftimg"> 
									
									<a href="{{ url('/photoDetail') }}/{{ $next_photo->id }}" >
										<img src="{{ $next_photo->pic_url }}" alt="{{ $next_photo->title }}" title="{{ $next_photo->title }}" />
									</a>
									
								</div>
                            </div>
							@else
							@endif
							
							
                        </div>
						
						
                    </div>
                </div>
            </div>
            
			
			<div class="share-box">
				
				<!--点赞评论-->
				<span id="photo_praise_warn_{{ $photo_info->id }}"></span>
				<div class="praise">
					<span id="photo_praise_{{ $photo_info->id }}" onclick="replyPraise('photo',{{ $photo_info->id }},5);" isPraise="false" style="cursor:pointer;"  ><img src="{{ asset('/images/articles/zan.png') }}" id="photo_praise_img_{{ $photo_info->id  }}" />
					</span>
					<span id="photo_praise_txt_{{ $photo_info->id  }}">{{ $photo_info->good }}</span>
				</div>

				<!--评论-->
				<div class="praise">
					<span class="share"><img src="{{ asset('/images/articles/ping.png') }}" id="praise-img"/></span>
					<span class="share_number">{{ $comments_total }}</span>
				</div>
				
				<!--收藏-->	
				<div class="praise">
					@if( session('user_name') )
						<span id="photo_collect_{{ $photo_info->id }}" onclick="collect('photo',{{ $photo_info->id }},3);" style="padding-top:-6px;display:inline-block;cursor:pointer;" isCollect='false'  >
							<img src="{{ asset('/images/articles/cang.png') }}"  id="photo_collect_img_{{ $photo_info->id }}"  >
						</span>		
					@else
						<span id="collectLogin" style="cursor:pointer;"  >
							<img src="{{ asset('/images/articles/cang.png') }}"  />
						</span>		
					@endif
					
				</div>
				
			</div>
			
        </div>
      
		 <!--评论部分-->
        <div class="comment-area">

            <!--发布评论-->
            <div class="input-area">

				<span class="left-text">
                    <em class="red comment-count">{{ $comments_total }}&nbsp;</em>条评论
                </span>
                <textarea name="comment-content" placeholder="写下您的评论..."></textarea>
                <!--错误提示-->
                <div class="err-tip" style="font-size: 12px">
                </div>
                <!--评论按钮-->
                @if( session('user_name') )
                <!-- 登陆了直接评论 -->
                <div class="user-panel">
                    <a id="comment" class="submit-btn">评论</a>
                </div>
                @else
                <!-- 未登陆先登录 -->
                <div class="user-panel" id="comment_login">
                    <a href="#" class="submit-btn">评论</a>
                </div>
                @endif


            </div>


            <!--历史评论-->
            <div class="comment-container">
                <div class="header">
                    <span>最新评论</span>
                </div>
                <div class="comment-list">
                    <!-- 1.遍历评论 -->
                    @forelse( $comments as $key => $comment_info )
		

                    <div class="comment-item" style="height:auto;overflow:hidden;">
                        <a href="{{ url('/showcenter') }}/{{ $comment_info->user_id }}" style="width:50px;height:50px;float:left;dispaly:inline-block;">
							<img class="commentor-avatar" src="{{ $comment_info->user_pic  }}" alt="">
						</a>
                        <div style="width:710px;height:auto;float:left;">
                            <!--评论-->
                            <div class="detail">
                                <!--评论人-->
                                <span class="name"><a href="{{ url('/showcenter') }}/{{ $comment_info->user_id }}">{{ $comment_info->name  }}</a></span>
                                <!--评论内容-->
                                <span class="content">{{ $comment_info->content  }}</span>
                                <div>
                                    <!--评论时间-->
                                    <span class="comment-time">{{ $comment_info->create_at  }}</span>


                                    <!--回复按钮-->
                                    <div class="btns">
                                        <!-- 回复按钮 -->
                                        @if( session('user_name') )
                                        <!-- 登陆了出现回复窗口 -->
                                        <a onclick="showReply({{ $comment_info->id  }})">回复</a>
                                        @else
                                        <!-- 未登陆先登录 -->
                                        <a class="replylogin">回复</a>
                                        @endif
                                    </div>

                                    <!-- 评论点赞 -->

                                    <div class="reply-praise">
											<span id="reply_praise_{{ $comment_info->id  }}" onclick="replyPraise( 'reply', {{ $comment_info->id  }},3 )" isPraise="false">
												<img src="{{ asset('/images/articles/zan.png') }}" id="reply_praise_img_{{ $comment_info->id  }}" />
											</span>
                                        <span id="reply_praise_txt_{{ $comment_info->id  }}">{{ $comment_info->good }}</span>
                                    </div>
                                    <span id="reply_praise_warn_{{ $comment_info->id  }}"></span>

                                </div>

                            </div>


                            <!-- 2.遍历评论下的回复 -->
                            @forelse( $comments_reply[$key] as $ke => $reply_info )
									
                            <!-- 回复评论留言 -->
                            <div class="reply_area" style="display:block">
                                <a href="{{ url('/showcenter') }}/{{ $reply_info['reply_user_id'] }}" class="reply_area_img">
									<img src="{{ $reply_info['uuser_pic'] }}" alt="">
								</a>

                                <!-- 回复者姓名 -->
                                <span> 
									<a href="{{ url('/showcenter') }}/{{ $reply_info['reply_user_id'] }}"><span class="reply_name">{{ $reply_info['replyname'] }}</span></a>@ 
									<a href="{{ url('/showcenter') }}/{{ $reply_info['user_id'] }}"><span class="reply_name">{{ $reply_info['username'] }}</span></a>
								</span>

                                <p class="reply_content reply_content1" style="width:auto;font-size:13px">
                                    <!-- 回复内容 -->
                                    {{ $reply_info['content'] }}</p>
                                <div>
                                    <!-- 回复时间 -->
                                    <span class="comment-time"
                                          style="color:#777">{{ $reply_info['create_at']  }}</span>


                                    <!-- 回复按钮 -->
                                    @if( session('user_name') )
                                    <!-- 登陆了出现回复窗口 -->
                                    <div class="btns">
                                        <a style="color:#777" onclick="huifu({{ $reply_info['id'] }});" >回复</a>
                                    </div>
                                    @else
                                    <!-- 未登陆先登录 -->
                                    <div class="btns">
                                        <a style="color:#777" class="replylogin" >回复</a>
                                    </div>
                                    @endif

                                    <!-- 回复点赞 -->
                                    <div class="reply-praise">
											<span id="huifu_praise_{{ $reply_info['id']  }}" onclick="replyPraise('huifu',{{ $reply_info['id'] }},4);" isPraise="false">
												<img src="{{ asset('/images/articles/zan.png') }}" id="huifu_praise_img_{{ $reply_info['id'] }}"/>
											</span>
                                        <span id="huifu_praise_txt_{{ $reply_info['id'] }}">{{ $reply_info['good'] }}</span>
                                    </div>
                                    <span id="huifu_praise_warn_{{ $reply_info['id']  }}" ></span>




                                </div>

                            </div>

                            <!-- 遍历评论下的回复 的回复窗口 -->
                            <div class="input-area" id="huifu_{{ $reply_info['id'] }}" style="height:120px;margin-top:5px;display:none">

									<textarea name="comment-content" style="width:700px;"
                                              id="huifu_content_{{ $reply_info['id'] }}"></textarea>

                                <!--错误提示-->
                                <div class="err-tip" style="font-size: 12px"></div>

                                <!--提交按钮 -->
                                <div class="user-panel reply-user-panel" style="margin: 10px 50px 0 0">
                                    <!-- 提交按钮 -->
                                    <a class="submit-btn" id="huifuBtn_{{ $reply_info['id']  }}"
                                       onclick="reply( 'huifu',{{ $comment_info->id }} ,{{ $reply_info['reply_user_id'] }},{{ $reply_info['id'] }} );">提交</a>
                                </div>

                            </div>


                            @empty
                            @endforelse

                            <!-- 回复窗口-->
                            <div class="input-area" id="reply_{{ $comment_info->id }}" style="height:120px;margin-top:5px;display:none">

									<textarea name="comment-content" style="width:700px;"
                                              id="reply_content_{{ $comment_info->id  }}"></textarea>

                                <!--错误提示-->
                                <div class="err-tip" style="font-size: 12px"></div>

                                <!--提交按钮 -->
                                <div class="user-panel reply-user-panel" style="margin: 10px 50px 0 0">
                                    <!-- 提交按钮 -->
                                    <a class="submit-btn" id="replyBtn_{{ $comment_info->id  }}"
                                       onclick="reply( 'reply',{{ $comment_info->id }} ,{{ $comment_info->user_id }},{{ $comment_info->id  }} );">提交</a>
                                </div>

                            </div>
                        </div>
                    </div>
                    @empty
                    @endforelse

                </div>
				<div style="text-align:center;font-size:16px;" >
					{{ $comments->links() }} 
				</div>
                <!-- 加载更多
                <div id="loadMore" class="load-more">
                    <a href="javascript:;" onClick="lanren.loadMore();">加载更多</a>
                </div>-->
            </div>

        </div>
		
    </div>
	
	
	
    <!--右边相关内容-->
	<div class="right-con">
		
		<div class="rela-album">
			<div class="hd">
				<h2>相关图集</h2>
				<a href="{{ url('/photoCategoryList') }}/{{ $photo_info->category_id }}"><i></i>更多</a>
			</div>
			<ul>
				@forelse( $refer as $key => $pic_info )
					<li>
						<a href="{{ url('/photoDetail') }}/{{ $pic_info['id'] }}"  >
							<img src="{{ $pic_info['pic_url'] }}" title="{{ $pic_info['title'] }}" alt="{{ $pic_info['title'] }}" />
						</a>
					</li>
				@empty
				@endforelse
				
				
				
			</ul>

		</div>
	   

	   <div class="hot-album">
			<div class="hd">
				<h2>热门图集</h2>
				<a href="{{ url('/photoList') }}"><i></i>更多</a>
			</div>
			<ul>
				@forelse( $hots as $key => $pic_info )
				<li>
					<a href="{{ url('/photoDetail') }}/{{ $pic_info['id'] }}">
						<img src="{{ $pic_info['pic_url'] }}" title="{{ $pic_info['title'] }}" alt="{{ $pic_info['title'] }}" />
					</a>
				</li>
				@empty
				@endforelse
				
			</ul>
		</div>
		
		
	</div>


</div>
                           
  


<script type="text/javascript" >
$(function () {
    function s() {
	//预览大图
	/*
	*  s  大图的索引
	*  piclistshow 列表展示
	*	selectpi 红色边框
	*/
        var s = parseFloat($("#pic1").attr("curindex")), 
			i = e.length;
			//如果大图为block，图册展示结束提示为none时 
        if ($(".picshowtop").css("display", "block"), $(".end-msg").css("display", "none"), s != i - 1) {
            var t = e.eq(s);
				s > 3 && ($(".picshowtop").css("display", "block"), 
				$(".end-msg").css("display", "none"), 
				e.eq(s - 4).css("display", "none"),
				e.eq(s + 1).css("width", "116px").css("display", "block"));
            var c = e.eq(s + 1),
				n = c.find("img").attr("bigimg"), 
				l = c.find("img").attr("text");
				t.find("img").removeClass("selectpic"),
				c.find("img").addClass("selectpic"), 
				$("#pic1").attr("src", n),
				$("#pic1").attr("curindex", s + 1),
				$(".picshowtxt_right").text(l), 
				$(".picshowtxt_left span").text(s + 2)
        } else $(".picshowtop").css("display", "none"), 
			   $(".end-msg").css("display", "block")
    }

    function i() {
        var s = parseFloat($("#pic1").attr("curindex"));
        if ($(".picshowtop").css("display", "block"), $(".end-msg").css("display", "none"), 0 != s) {
            var i = e.eq(s),
				t = e.length;
				s <= t - 5 && (e.eq(s + 4).css("display", "none"), e.eq(s - 1).css("width", "116px").css("display", "block"));
            var c = e.eq(s - 1), 
				n = c.find("img").attr("bigimg"), 
				l = c.find("img").attr("text");
				i.find("img").removeClass("selectpic"), 
				c.find("img").addClass("selectpic"), 
				$("#pic1").attr("src", n), 
				$(".picshowtxt_right").text(l), 
				$("#pic1").attr("curindex", s - 1), 
				$(".picshowtxt_left span").text(s)
        } else $(".bodymodal").css("display", "block"), 
				$(".picshowtop").css("display", "block")
    }

    function t() {
        var s = $(window).width() / 2 - 300;
        $(".firsttop").css("left", s),
		$(".endtop").css("left", s)
    }

    function c() {
        $(".firsttop").css("display", "block"),
		$(".piclistshow").css("display", "none"), 
		$(".source_right").css("display", "block"),
		$(".source_right1").css("display", "none")
    }
	//列表展示
    $(".piclistshow li").hover(function () {
        $(this).css("background", "#FAFAFA")
    },function () {
        $(this).css("background", "white")
    }), 
	$(".piclistshow li").last().css("border-bottom", "none"), 
	$(".piclistshow li").each(function () {
        var s = $(this).index(".piclistshow li") + 1;
        s % 4 == 0 && $(this).css({"border-right": "none", "width": "251px"})
    }), 
	$(document).keydown(function (t) {
        var c = t.keyCode, 
			n = $(".end-msg").css("display");
			"none" == n ? 37 == c ? i() : 39 == c && s() : 27 == c && ($(".firsttop").css("display", "none"), 
			$(".bodymodal").css("display", "none"),
			$(".endtop").css("display", "none"))
    });
    var n = $(".picmidmid ul li").first().find("img"),
		l = n.attr("bigimg"), 
		o = n.attr("text");
    $("#pic1").attr("src", l),
	n.addClass("selectpic"), //选中列表添加边框
	$(".picshowtxt_right").text(o), //大图文字说明
	
	//鼠标经过上一页/下一页显示标签
	$("#preArrow").hover(function () {
        $("#preArrow_A").css("display", "block")
    }, function () {
        $("#preArrow_A").css("display", "none")
    }), $("#nextArrow").hover(function () {
        $("#nextArrow_A").css("display", "block")
    }, function () {
        $("#nextArrow_A").css("display", "none")
    });
	
	//鼠标点击上一页/下一页
    var e = $(".picmidmid ul li");
    $("#nextArrow_B").click(function () {
        s()
    }),$("#nextArrow").click(function () {
        s()
    }), $("#preArrow_B").click(function () {
        i()
    }), $("#preArrow").click(function () {
        i()
    }),
	e.click(function () {
        $(".picshowtop").css("display", "block"), 
		$(".end-msg").css("display", "none");
        var s = $(this).index(".picmidmid ul li");
        $(".picmidmid ul li img[class='selectpic']").removeClass("selectpic");
        var i = e.eq(s);
        i.find("img").addClass("selectpic");
        var t = i.find("img").attr("bigimg"), 
			c = i.find("img").attr("text");
        $("#pic1").attr("src", t), 
		$("#pic1").attr("curindex", s),
		$(".picshowtxt_right").text(c), 
		$(".picshowtxt_left span").text(s + 1)
    }), $(".piclistshow li").click(function () {
        $(".picshowtop").css("display", "block"), 
		$(".end-msg").css("display", "none");
        var s = $(this).index(".piclistshow li");
        c(), 
		$(".picmidmid ul li img[class='selectpic']").removeClass("selectpic");
        var i = e.eq(s);
        i.find("img").addClass("selectpic");
        var t = i.find("img").attr("bigimg"),
		n = i.find("img").attr("text");
        if ($("#pic1").attr("src", t), 
		$("#pic1").attr("curindex", s), 
		$(".picshowtxt_right").text(n), 
		$(".picshowtxt_left span").text(s + 1), 
		$(".picmidmid li").css("display", "block"), 
		s >= 5)for (var l = s - 5, o = 0; o <= l; o++)e.eq(o).css("display", "none")
    }), 
	t(),
	$(window).resize(function () {
        t()
    }),
	$(".list").click(function () {
        $(".picshow").css("display", "none"),
		$(".piclistshow").css("display", "block"), 
		$(".source_right").css("display", "none"), 
		$(".source_right1").css("display", "block")
    }), $(".gaoqing").click(function () {
        c()
    }), 
	$(".rank ul").first().css("display", "block"), 
	$(".ranknext").click(function () {
        var s = $(this).attr("show"), 
			i = parseInt(s) + 1, 
			t = $(".rank ul").length;
        i < t ? ($(".rank ul").eq(s).css("display", "none"), 
		$(".rank ul").eq(i).css("display", "block"), 
		$(this).attr("show", i), 
		$(".rank ul").eq(i).find("img").lazyload()) : ($(".rank ul").css("display", "none"), 
		$(".rank ul").first().css("display", "block"), 
		$(this).attr("show", 0), 
		$(".rank ul").first().find("img").lazyload())
    }), 
	$(".tuijian").click(function () {
        var s = $(this).attr("show"), 
			i = parseInt(s) + 1, 
			t = $(".rank1 ul").length;
        i < t ? ($(".rank1 ul").eq(s).css("display", "none"), 
		$(".rank1 ul").eq(i).css("display", "block"), 
		$(this).attr("show", i)) : ($(".rank1 ul").css("display", "none"), 
		$(".rank1 ul").first().css("display", "block"), 
		$(this).attr("show", 0))
    }), $("#replay").click(function () {
        $(".picmidmid ul li").eq(0).click()
    })
});
</script>
<div id="photo_id" photo_id="{{ $photo_info->id }}"></div>
<script type="text/javascript">
	var _token = $('meta[name="csrf-token"]').attr('content');
    $(function () {
        // 创建 评论
        $("#comment").click(function (){
            // 获取 评论 内容
            var content = $("textarea[name='comment-content']").val();
            if (!content) {
                alert('请输入您要评论的内容');
				return false;
            }
            var photo_id = $("#photo_id").attr('photo_id');
            $.ajax({
                type: "post",
                url: "{{ url('/comment') }}/3",
                data: {record_id: photo_id, content: content, _token: _token},
                async: false,
                dataType: "json",
                success: function (back) {
                    if (back['show_info'] == '评论成功') {

                        $('.err-tip').html('');
                        $('.err-tip').html(back['show_info']);
                        $(".err-tip").slideDown(1500);
                        $(".err-tip").delay(1500).slideUp(1000);
                        $("textarea[name='comment-content']").val('');
                        setTimeout(function () {
                            location.reload();
                        }, 1000);
                    } else {
                        $('.err-tip').html('');
                        $('.err-tip').html(back['show_info']);
                        $(".err-tip").slideDown(1500);
                        $(".err-tip").delay(1500).slideUp(1000);
                    }
                }
            });
        });

    })

</script>

@extends('common.footer')


</body>
</html>